
import { BASE_URL, TIME_OUT } from "./config";
import HYRequest from "./request";
// 根据类实例化一个对象 在模块中导入发送网络请求
const hyRequest = new HYRequest({
    baseURL: BASE_URL,
    timeout: TIME_OUT
})
export const hyRequest2 = new HYRequest({
    baseURL: "http://codercba.com:1888/airbnb/api",
    timeout: 8000,
    // new实例的时候 拦截器  添加额外的

    interceptors: {
        requestSuccessFn: (config) => {
            console.log('爱彼应的请求成功的拦截');
            return config
        },
        requestFailureFn: (err) => {
            console.log('爱彼应的请求失败的拦截');

            return err
        },
        responseSuccessFn: (res) => {
            console.log('爱彼应的响应成功的拦截');

            return res
        },
        responseFailureFn: (err) => {
            console.log('爱彼应的请求失败的拦截');

            return err
        },

    }
})
export default hyRequest